package com.centronix.web.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTimeUtil {
	public static String getFormattedDate(Date date) {
		return new SimpleDateFormat("yyyy/MM/dd").format(date);		
	}
	
	public static Date removeTimeFromDate(Date date){
		return toDate(getFormattedDate(date), "yyyy/MM/dd"); 
	}
	
	public static java.util.Date toDate(String strDate, String pattern) {
		try {
			return new SimpleDateFormat(pattern).parse(strDate);
		} catch (ParseException e) {
			return null;
		}		
	}
}
